<?php
namespace app\service;
use think\facade\Db;
class statisticsService{
    //根据用户ID查询权限ID
    public function idUserType($id){
        return Db::name('admin')->where('id',$id)->value('usertype');
    }
    //查询小区数据
    public function communityList($where){
        return Db::name('community')->where($where)->select();
    }
     public function communitycount($where){
        return Db::name('community')->where($where)->count();
    }
    //查询已上传支付宝账单总金额
    public function billMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单已收款总金额
    public function payBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单未收款总金额
    public function noPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','WAIT_PAYMENT')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','WAIT_PAYMENT')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单已收款账单数
    public function PayBillSum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
    }
    //查询已上传支付宝账单未收款账单数
    public function noPayBillSum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','WAIT_PAYMENT')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','WAIT_PAYMENT')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
    }
    //查询已上传支付宝账单支付宝收款总额
    public function aliPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','支付宝')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','支付宝')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单微信收款总额
    public function weiPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','微信')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','微信')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单现金收款总额
    public function xianPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','现金')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','现金')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单POS机收款总额
    public function posPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','POS机')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','POS机')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单银行转账收款总额
    public function bankPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','银行卡')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','银行卡')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单抵用券收款总额
    public function quanPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','抵用券')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','抵用券')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询已上传支付宝账单其他收款总额
    public function otherPayBillMoneySum($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('pay_type','其他')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','其他')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询账号信息
    public function adminIdList($id){
        return Db::name('admin')->where('id',$id)->find();
    }
    public function adminUpdate($data){
        return Db::name('admin')->update($data);
    }
    //-------------------------------------------------------------------------------------交易中心----------------------------------------------------------------------------------------//
    //查询费用类型
    public function billTypeList($community_id,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->column('cost_type');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->column('cost_type');
    }
    //根据缴费类型查询缴费户数
    public function billSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->select();
    }
    //根据缴费类型查询支付宝缴费总额
    public function billALiPaySum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','支付宝')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','支付宝')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询微信缴费总额
    public function billWeiXinSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','微信')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','微信')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询现金缴费总额
    public function billXianJinSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','现金')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','现金')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询POS机缴费总额
    public function billPosSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','POS机')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','POS机')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询银行卡缴费总额
    public function billYinHangSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','银行卡')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','银行卡')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询抵用券缴费总额
    public function billQuanSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','抵用券')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','抵用券')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //根据缴费类型查询其他缴费总额
    public function billQiTaSum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('pay_type','其他')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('pay_type','其他')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //查询费用类型总金额
    public function billTypePaySum($community_id,$cost,$gmt_payment_start,$gmt_payment_end){
        return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id', 'in', $community_id)->where('cost_type',$cost)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment' , '>=' , $gmt_payment_start)->where('gmt_payment' , '<=' , $gmt_payment_end)->sum('bill_entry_amount');
    }
    //-------------------------------------------------------------------------------------月度报表----------------------------------------------------------------------------------------//
    //根据月份查询费用类型
    public function billMonthlyTypeList($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->column('cost_type');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->column('cost_type');
    }
    //查询其他业务缴费总金额
    public function cashierYueSum($community_id,$yue){
        return Db::name('cashier')->where('community_id','in',$community_id)->where('time','like','%-'.$yue.'-%')->sum('money');
    }
    //根据月份费用类型查询数据
    public function monthlyCostBillSum($community_id,$yue,$cost){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('cost_type',$cost)->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('cost_type',$cost)->sum('bill_entry_amount');
    }
    //查月度缴费总额
    public function monthlySum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->sum('bill_entry_amount');
    }
    //查月度支付宝缴费总额
    public function monthlyALiPaySum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','支付宝')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','支付宝')->sum('bill_entry_amount');
    }
    //查月度微信缴费总额
    public function monthlyWeiXinSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','微信')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','微信')->sum('bill_entry_amount');
    }
    //查月度现金缴费总额
    public function monthlyXianJinSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','现金')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','现金')->sum('bill_entry_amount');
    }
    //查月度POS机缴费总额
    public function monthlyPosSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','POS机')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','POS机')->sum('bill_entry_amount');
    }
    //查月度银行卡缴费总额
    public function monthlyYinHangSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','银行卡')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','银行卡')->sum('bill_entry_amount');
    }
    //查月度抵用券缴费总额
    public function monthlyQuanSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','抵用券')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','抵用券')->sum('bill_entry_amount');
    }
    //查月度其他缴费总额
    public function monthlyQiTaSum($community_id,$yue){
        return Db::name('bill')->where('community_id','in',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','其他')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id','in',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like','%-'.$yue.'-%')->where('pay_type','其他')->sum('bill_entry_amount');
    }
    //-------------------------------------------------------------------------------------年度报表----------------------------------------------------------------------------------------//
    //查询小区名称
    public function communityIdName($community_id){
        return Db::name('community')->where('community_id',$community_id)->value('community_name');
    }
    //查询该小区账单总金额
    public function communityBillSum($community_id,$year){
        return Db::name('bill')->where('community_id',$community_id)->where('release_day','like',$year.'%')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id',$community_id)->where('tongbu',1)->where('release_day','like',$year.'%')->sum('bill_entry_amount');
    }
    //查询该小区已收款总额
    public function communityBillTradeSum($community_id,$year){
        return Db::name('bill')->where('community_id',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$year.'%')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$year.'%')->sum('bill_entry_amount');
    }
    //
    public function communityTradetimeSu($community_id,$tradetime){
        return Db::name('bill')->where('community_id',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$tradetime.'%')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$tradetime.'%')->sum('bill_entry_amount');
    }
    //根据时间查询缴费业务类型
    public function billYearTypeList($community_id,$year){
        return Db::name('bill')->where('community_id',$community_id)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$year.'%')->column('cost_type');
        //return Db::name('bill')->where('community_id',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('gmt_payment','like',$year.'%')->column('cost_type');
    }
    //根据业务类型查询收款金额
    public function yearCostBillSum($community_id,$cost,$year){
        return Db::name('bill')->where('community_id',$community_id)->where('status','TRADE_SUCCESS')->where('cost_type',$cost)->where('gmt_payment','like',$year.'%')->sum('bill_entry_amount');
        //return Db::name('bill')->where('community_id',$community_id)->where('tongbu',1)->where('status','TRADE_SUCCESS')->where('cost_type',$cost)->where('gmt_payment','like',$year.'%')->sum('bill_entry_amount');
    }
    //查询其他业务缴费总金额
    public function cashierYearSum($community_id,$year){
        return Db::name('cashier')->where('community_id','in',$community_id)->where('time','like',$year.'%')->sum('money');
    }

    //----------------------------年度报表------------------------------
    public function sumBill($where){
        return Db::name('bill')->where($where)->sum('bill_entry_amount');
        //return Db::name('bill')->where($where)->where('tongbu',1)->sum('bill_entry_amount');
    }
    public function billType($where){
         return Db::name('bill')->where($where)->column('cost_type');
         //return Db::name('bill')->where($where)->where('tongbu',1)->column('cost_type');
    }
}